import 'package:flutter/cupertino.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';

import '../../../common/models/ly_user_works_model.dart';
import '../../../utils/ly_data_manager.dart';

class LYWorksListController extends GetxController {
  List<LYWorksModel> worksList = [];

  @override
  void onReady() {
    super.onReady();
    refreshWorksData();
  }

  void refreshWorksData() {
    EasyLoading.show();
    LYDataManager.share.initUserAndWorksData().then((value) {
      worksList = LYDataManager.share.allUserWorks
          .where((element) => element.isBlack != true)
          .toList();
      update(['list']);
      EasyLoading.dismiss();
    });
  }
}
